package com.design.builder;

import com.design.builder.body.MldBody;
import com.design.builder.body.YjBody;
import com.design.builder.handle.FhHandle;
import com.design.builder.handle.XdsHandle;
import com.design.builder.wheel.CkWheel;
import com.design.builder.wheel.JatWheel;

/**
 * 建造者模式
 * 使用场景:一些基本物料不会变，而其组合经常变化的情况
 * 假设一辆自行车是由车把手、车身和车轮构成
 * 车把手、车身和车轮分别具有不同的生产厂家，一辆价格不同的车零部件构成品牌各不相同
 * @author ytj
 * @date 2024/11/27 14:47
 */
public class Builder {
    public IMenu one(){
        return new BicyclePackage("公路车").appendHandle(new XdsHandle()).appendWheel(new CkWheel()).appendBody(new MldBody());
    }

    public IMenu two(){
        return new BicyclePackage("山地车").appendHandle(new XdsHandle()).appendWheel(new JatWheel()).appendBody(new YjBody());
    }

    public IMenu three(){
        return new BicyclePackage("普通自行车").appendHandle(new FhHandle()).appendWheel(new JatWheel()).appendBody(new YjBody());
    }


    public static void main(String[] args) {
        Builder builder=new Builder();
        builder.one().getDetail();
        builder.two().getDetail();
        builder.three().getDetail();
    }
}
